import Vue from 'vue'
import confirm from '../components/signTaskDialog/signTaskDialog';

let ConfirmConstructor = Vue.extend(confirm);
let instance;
const signTaskDialog = function(options = {}) {
  return new Promise((resolve,reject) => {
    instance = new ConfirmConstructor({
      el: document.createElement('div'),
      data: options,
    }).$mount();
    instance.open();
    document.body.appendChild(instance.$el);
    instance.content = options;
    instance.handleConfirm = function() {
      instance.closeConfirm();
      resolve();
    }
  })
}

export default signTaskDialog;
